/*
 * 版权所有 (c) 2022-2099 TBIT。保留所有权利。
 */

/*
 * 版权所有 (c) 2022-2099 TBIT。保留所有权利。
 */

package com.tbit.main.constant;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.EnumValue;

/**
 * 标签状态
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/9
 */
public enum TagStatus {
    ENABLED("enabled",1, "启用"),
    DISABLED("disabled",0, "禁用"),
    DELETED("deleted",-1, "删除");

    private String code;
    @EnumValue
    private Integer value;
    private String desc;

    TagStatus(String  code, Integer value, String desc) {
        this.code = code;
        this.value = value;
        this.desc = desc;
    }

    public static TagStatus getTagStatusByCode(String code) {
        for (TagStatus tagStatus : TagStatus.values()) {
            if (tagStatus.code.equals(code)) {
                return tagStatus;
            }
        }
        return null;
    }
    @JSONField(serialize = true)
    public String getCode() {
        return code;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code;
    }
}
